import csv
import numpy

matrix = open ("Z:\Ad_Methods\Tabelle_30.csv")
inhalt = csv.reader (matrix,delimiter=";", quoting=csv.QUOTE_NONNUMERIC)
liste = []
liste_trans = []
summe_zeile = []
spalte_zeile = []

def matrix_einlesen(matrix):
    for row in inhalt:
        liste.append (row)
    return liste
print matrix_einlesen(matrix)


def matrix_trans(liste):
    for col in range (0, len (liste [0])):
        liste_trans.append (len (liste))
    for row in range (0, len(liste)):
        for col in range (0, len(liste [0])):
            liste_trans [col][row] = liste [row][col]
        return liste_trans
    
#print matrix_trans(liste)

# zeilensumme
def summe_zeile (liste):
    s=0
    for z in range (0, len (liste)):
        for i in range (0, len (liste [0])):
            s = s +  (liste[s]) [i]
        summe_zeile.append (s)
    return summe_zeile

print summe_zeile(liste)

#spaltensumme
def spalte_zeile (liste):
    s=0
    for s in range (0, len (liste [0])):
        for i in range (0, len (liste)):
            s = s + (liste[s])[i]
        summe_spalte.append (s)
    return summe_spalte

print summe_spalte(liste)
